<template>
    <div>
        <van-swipe :autoplay="3000">
            <van-swipe-item v-for="i in xqlist.pics">
                <van-image class="img1" :src="i.pics_mid" />
            </van-swipe-item>
        </van-swipe>
        <div v-html="xqlist.goods_introduce"></div>
    </div>
    <van-submit-bar :price="(xqlist.goods_price) * 100" button-text="加入购物车" @submit="onSubmit">
        <van-button type="primary" size="small" to="/home/gwc">购物车</van-button>
    </van-submit-bar>
</template>

<script setup>
import { ref } from 'vue';
import axios from 'axios';
import { useRoute } from 'vue-router';
import { useRouter } from 'vue-router';
import { usegwc } from '../pinia';
const {gwc_list}=usegwc()
const route = useRoute()
const router = useRouter()
const xqlist = ref([])
axios.get('https://api-hmugo-web.itheima.net/api/public/v1/goods/detail', {
    params: {
        goods_id: route.query.goods_id
    }
}).then((res) => {
    xqlist.value = res.data.message
})
const onSubmit = () => {
    gwc_list({...xqlist.value,number:1,checked:true})
}
;
</script>

<style>
.img1 {
    width: 100%;
}
</style>